package org.testing.model.questions;

import org.testing.model.InOutManager;
import org.testing.model.correctQuestionAnswers.CorrectAnswer;
import org.testing.model.results.DoubleResult;
import org.testing.model.results.Result;
import org.testing.model.userAnswers.SimpleUserAnswer;
import org.testing.model.userAnswers.UserAnswer;
import org.testing.model.variants.Variant;

public class YesNoQuestion implements Question {
	private String helpText = "Please, enter \"yes\" if you agree with statement or \"no\" if not \n";
	private CorrectAnswer correctAnswer;
	private String bodyText;
	
	public YesNoQuestion(String bodyText, CorrectAnswer correctAnswer ) {
		this.bodyText = bodyText;
		this.correctAnswer = correctAnswer;
	}

	@Override
	public String getHelp() {
		return this.helpText;
	}
	
	@Override
	public UserAnswer readUserAnswer(InOutManager inOut) {
		return new SimpleUserAnswer(inOut.inPutLine());

	}

	@Override
	public Result check(UserAnswer userAnswer) {
		return new DoubleResult(this.correctAnswer.equals(userAnswer));
	}

	public String toString() {
		return this.bodyText;
	}
	
	//No variants for this type of question
	@Override
	public void addVariant(Variant variant) {
		// stub
		
	}

	

}
